package ua.kharkiv.dereza.bookmaker.command;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import ua.kharkiv.dereza.bookmaker.bean.ClientBean;
import ua.kharkiv.dereza.bookmaker.core.Constants;
/**
 * Forwards to page with client's account settings
 * 
 * @author Eduard
 *
 */
public class SettingsForwardCommand extends Command{
	
	private static final Logger log = Logger.getLogger(SettingsForwardCommand.class);
	
	@Override
	public String execute(HttpServletRequest req, HttpServletResponse res) {
		log.debug("Command started");
		String forward = null;
		
		ClientBean bean = (ClientBean) req.getSession().getAttribute("clientbean");
		
		req.setAttribute("balance", bean.getBalance());
		req.setAttribute("name",bean.getName());
		req.setAttribute("surname",bean.getSurname());
		req.setAttribute("email", bean.getEmail());
		
		req.setAttribute("title", "Settings");
		forward = Constants.PAGE_SETTINGS;
		log.debug("Command finished");
		return forward;
	}

}
